<!DOCTYPE html>
<html>
    <head>
        <script src="./js/brain.js"></script>
    </head>
    <body>
        <h1>Deep Learning with brain.js</h1>
        <div id="demo"></div>
        <script>
            const network = new brain.NeuralNetwork();
            //测试异或
            network.train([
                {input:[0,0],output:{zero:1}},
                {input:[0,1],output:{one:1}},
                {input:[1,0],output:{one:1}},
                {input:[1,1],output:{zero:1}},
            ])

            let result = network.run([1,0]);

            document.getElementById("demo").innerHTML = "one: "+result["one"] + "<br>" + "zero: " + result["zero"];

        </script>
    </body>
</html>